<!DOCTYPE html>
<html lang="ch" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title></title>
</head>
<body>
<h3>投票详情</h3>
<table border="1">
  <tr>
    <th>投票名称</th>
    <th>投票介绍</th>
    <th>查看</th>
    <th>删除</th>
  </tr>
  <tr th:each="vote:${votes}">
    <th th:text="${vote.title}"></th>
    <th th:text="${vote.description}"></th>
    <th>
      <button name="show" th:onclick="|showVote(${vote.id})|">查看详情</button>
    </th>
    <th>
      <button name="delete" th:onclick="|deleteVote(${vote.id})|">删除投票</button>
    </th>
  </tr>
</table>
</body>
</html>
<script>
  function showVote(id) {
    window.location.href = "/show/" + id;
  }

  function deleteVote(id) {
    window.location.href = "/delete_vote/" + id;
  }
</script>